#region

using Gurock.SmartInspect;
using Microsoft.Practices.Unity.InterceptionExtension;

#endregion

namespace SmartInspect.Extensions.Unity
{
    public class SiProcessCallHandler : SiWrappedCallHandler
    {
        private string _processName;
        public string ProcessName { private get; set; }

        protected override void Enter(IMethodInvocation input, Session ses)
        {
            _processName = FormatTitle(string.IsNullOrEmpty(ProcessName) ? input.MethodBase.Name : ProcessName);
            ses.SendCustomProcessFlow(_processName, ProcessFlowType.EnterProcess);
        }

        protected override void Leave(IMethodInvocation input, Session ses, IMethodReturn ret)
        {
            ses.SendCustomProcessFlow(_processName, ProcessFlowType.LeaveProcess);
        }
    }
}